package com.zhenwei.zscm.controller;

import com.zhenwei.zscm.common.annotations.MethodName;
import com.zhenwei.zscm.common.base.RestResult;
import com.zhenwei.zscm.model.vo.menu.MenuVO;
import com.zhenwei.zscm.service.MenuService;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/menu")
@MethodName("菜单管理")
@AllArgsConstructor
public class MenuController {
    private MenuService menuService;

    @GetMapping("/all")
    @MethodName("获取菜单列表")
    public RestResult all(){
        return menuService.all();
    }

    @MethodName("添加菜单")
    @PostMapping("/create")
    public RestResult create(@RequestBody @Valid MenuVO vo){
        return menuService.create(vo);
    }
}
